package tommysmapeditor.helper;

import tommysmapeditor.input.MapEditorInput;


/**
 * various tile grid operations
 * @author lactho
 *
 */
public class TileGridHelper {

	public static void resize(MapEditorInput mei , int targetWidth, int targetHeight){
		int[][] newGrid = new int[targetWidth][targetHeight];
		
		//we copy old in new tile grid with index limit
		for(int x=0;x<targetWidth;x++){
			for(int y=0;y<targetHeight;y++){
				if(x<mei.getTileWidth()&&y<mei.getTileHeight()){
					newGrid[x][y] = mei.tileGrid[x][y];
				}else{
					newGrid[x][y]=0;
				}
				
			}
		}
		
		//new grid is composed we clean up input 
		mei._tileWidth=targetWidth;
		mei._tileHeight=targetHeight;
		mei.tileGrid = newGrid;
		System.out.println("resize complete");
//		for(int x=0;x<mei.tileGrid.length;x++){
//			for(int y=0;y<mei.ti)
//		}
	}
	
}
